package leetcode;

/**
 * @program: datastructureandalogorithm
 * @description:
 * @author: hmx
 * @create: 2021-10-30 18:02
 **/
public class LeetCode62 {

    public int uniquePaths(int m, int n) {
        int[][] f = new int[m][n];
        for (int i = 0; i < m; i++) {
            for (int i1 = 0; i1 < n; i1++) {
                if (i == 0 || i1 == 0) {
                    f[i][i1] = 1;
                } else {
                    f[i][i1] = f[i - 1][i1] + f[i][i1 - 1];
                }
            }
        }
        return f[m - 1][n - 1];
    }

}
